<template>

  <div>
     <el-row>
        <el-button type="primary">添加学生</el-button>
     </el-row>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item label="姓名">
              <span>{{ props.row.name }}</span>
            </el-form-item>
            <el-form-item label="学号">
              <span>{{ props.row.studentId }}</span>
            </el-form-item>
            <el-form-item label="性别">
              <span>{{ props.row.sex ===0?'男':'女'}}</span>
            </el-form-item>
            <el-form-item label="用户名">
              <span>{{ props.row.uname }}</span>
            </el-form-item>

            <el-form-item label="身份证">
              <span>{{ props.row.idCard }}</span>
            </el-form-item>
            <el-form-item label="注册时间">
              <span>{{ props.row.gmtCreate }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column label="学号" prop="studentId"></el-table-column>
      <el-table-column label="姓名" prop="name"></el-table-column>
      <el-table-column label="用户名" prop="uname"></el-table-column>
      <el-table-column label="注册时间" prop="gmtCreate"></el-table-column>
      <el-table-column label="操作" width="200" align="center">
              <template slot-scope="scope">
                <router-link :to="'/statistics/edt/'+scope.row.id">
                  <el-button type="primary" size="mini" icon="el-icon-edit">详情</el-button>
                </router-link>
              </template>
            </el-table-column>
    </el-table>
    <el-pagination
      :current-page="page.current"
      :page-size="page.size"
      :total="page.total"
      style="padding: 30px 0; text-align: center;"
      layout="total, prev, pager, next, jumper"
      @current-change="getlist"
    />

 
                
              
  </div>
  
</template>
<script>
// import eduUser from "@/api/eduUser";
import student from "@/api/student";
export default {
  data() {
    return {
      tableData: [],
      stu: {},
      page: {
         current: 1,
        size: 10,
        total: 0
      }
    };
  },
  created() {
    this.getlist();
  },
  methods: {
    //   id,username,password,salt,sex,type,user_img,sort,remarks,is_deleted,gmt_create
    // 查询列表
    getlist() {
      student
        .queryPage(this.page, this.stu)
        .then(response => {
          console.log(response);
          this.tableData = response.data.page.records;
          this.page.current = response.data.page.current;
          this.page.list = response.data.page.list;
          this.page.total = response.data.page.total;
        })
        .catch(); //请求失败执行
    }
  }
};
</script>

<style>
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>